﻿@model IEnumerable<Mvc5Ef6WebApiDataFirstNthW.Models.EditUserViewModel>
@using Microsoft.AspNet.Identity

@{
    ViewBag.Title = "Index";
}

<h2>Liste des utilisateurs</h2>

<p>
    @Html.ActionLink("Create New", "Register")
</p>
<table class="table">
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.UserName)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.FirstName)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.LastName)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Email)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Photo)
        </th>
        <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.UserName)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.FirstName)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.LastName)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Email)
        </td>
        <td>
            <img class="img-rounded" src="@item.PhotoUrl" alt="@item.UserName" title="@(item.FirstName + ' ' + item.LastName)" />
        </td>

        <td>
            <div class="btn-group">
                @Html.ActionLink("Edit", "Edit", new { id = item.UserName }, new { type = "button", @class = "btn btn-xs btn-primary" })
                @Html.ActionLink("Roles", "UserRoles", new { id = item.UserName }, new { type = "button", @class = "btn btn-xs" })
                @Html.ActionLink("Delete", "Delete", new { id = item.UserName }, new { type = "button", @class = "btn btn-xs btn-danger" })
            </div>
        </td>
    </tr>
}

</table>
